 (function($) {         
  $.fn.lin_stepIntroduction = function(options) {        
    var opts = $.extend({}, $.fn.lin_stepIntroduction.defaults, options);
	if(opts.masker)
	{
		$("."+opts.maskerClass).remove();
		var height = $('body').height() + 'px',
		width = $(window).width() + 'px',
		masker='<div class="'+opts.maskerClass+'"></div>';
		$("body").append(masker);
		$.fn.lin_stepIntroduction.showMask(opts.maskerClass,width,height,'block');
	}
   	startStep();
	var $this=$(this),
    stepNum=0,
	nextBtn=$this.find(opts.nextStep),
	closeBtn=$this.find(opts.closeStep);
	nextBtn.click(function(){
		var currentId=$(this).parent().attr("id"),
		$parent=$(this).parent();
		$parent.hide();
		stepNum++;
		var nextStep="#"+opts.stepStart+stepNum;
		if($(nextStep).length)
		{
			$(nextStep).show();
		}else{
				stepNum=0;
				hideStepMask();	
			 }
		});
	closeBtn.click(function(){
		stepNum=0;
		$(this).parent().hide();
		hideStepMask();
	});
	function startStep()
	{
		$("#"+opts.stepStart).css('left',function(){return ($(window).width() - $(this).width()) / 2;});
		$("#"+opts.stepStart).css('top',function(){return ($(window).height() - $(this).height()) / 2;});
		$("#"+opts.stepStart).show();
	}
	function hideStepMask()
	{
		if(opts.masker)$("."+opts.maskerClass).hide().remove();
	}
  };	
  
  $.fn.lin_stepIntroduction.showMask=function(maskerClass,width,height,display)
  {
		$('.'+maskerClass).css({
        "width": width,
        "height": height,
        "position":"absolute",
        "left":"0px",
        "top":"0px",		
		"filter":"alpha(opacity=80)",
		"background":"#000000",
		"z-index":0,
        "opacity":0.8,
		'display':display
    	});
  };
  
  $.fn.lin_stepIntroduction.defaults = {     
  	stepStart:"lin_step",//开始界面id
	masker:true,//遮罩控制
	maskerClass:'lin_stepMask',
	nextStep:".lin_nextStep",
	closeStep:".lin_closeStep"
  };  
  
})(jQuery); 